<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>dictionary</title>
    <%@include file="/static/common/commonHead.jsp" %>
    <script type="text/javascript" src="/static/js/email/email.js"></script>
</head>
<body>

<%--表格--%>
<div id="cc" class="easyui-layout" data-options="fit:true">
    <div style="width:280px;" data-options="region:'west',title:'发件人',split:true,tools:[{
            iconCls:'icon-remove',
			handler:function(){
                var row = $('#linkman').datagrid('getSelected');
                 if(!row){
                     $.messager.alert('温馨提示','请选择一条信息','info');
                     return;
                 }
                 $.messager.alert('温馨提示','确定要删除吗?','info',function () {
                    $.post('/email/deleteMessage.do', {'sourceEmp.id':row.sourceEmp.id,id:row.id}, function (data) {
                                if (data.success) {
                                    $.messager.alert('温馨提示', '删除成功', 'info',function(){
                                        $('#linkman').datagrid('load');
                                    });
                                } else {
                                    $.messager.alert('温馨提示', data.msg, 'info')
                                }
                     }, 'json');
                  });
			}
    }]">
        <table id="linkman" class="easyui-datagrid"></table>
    </div>
    <div data-options="region:'center',title:'接收信息栏',split:false" style="width:370px;">
        <div id="SandG" class="easyui-layout" data-options="fit:true">
            <div data-options="region:'center',title:'接收信息栏',split:false">
                <table>
                    <tr>
                        <td>
                            接收时间:<input type="text" id="getTime" width="100px" height="20px">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <hr>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <textarea id="getMessage" rows="10" cols="112"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
            <div  style="height: 250px"
                 data-options="region:'south',title:'发送信息栏',tools:[
				{
					iconCls:'icon-export',
					handler:function(){
                        var linkman = $('#linkman').datagrid('getSelected');
                        var colleague = $('#colleague').datagrid('getSelected');
                        var row ='';
                        if(linkman){
                            if(colleague){
                                 $.messager.alert('温馨提示','目前只能单个发送信息','info');
                                 return;
                            }
                        }
                        if(linkman){
                            var row = linkman.sourceEmp.id;
                        }
                        if(colleague){
                            var row = colleague.id;
                        }
                        if(!row){
                            $.messager.alert('温馨提示','请选择一条信息','info');
                        }
                        var textarea = $('#sendMessage').val();
                        $.post('/email/sendMessage.do', {'targetEmp.id':row,'textarea':textarea}, function (data) {
                            if (data.success) {
                                $.messager.alert('温馨提示', '发送成功', 'info',function(){
                                        $('#linkman').datagrid('load');
                                    });
                            } else {
                                $.messager.alert('温馨提示', data.msg, 'info')
                            }
                        }, 'json');
					}
				},{
					iconCls:'icon-reload',
					handler:function(){
					    $('#sendMessage').val('');
					}
				}]">
                <textarea id="sendMessage" rows="10" cols="112"></textarea>
            </div>
        </div>
    </div>
    <div data-options="region:'east',title:'同事列表'" style="width:250px;">
        <table id="colleague" class="easyui-datagrid"></table>
    </div>
</div>

</body>
</html>
